import { Action, Actor } from 'iflux2'
import { List } from 'immutable'

export default class NewsListActor extends Actor {

    defaultState() {
        return {
            tabs: 'news',// 微信图文news 高级图文adNews
            curPage: 1,
            newsList: {
                item: [],
                total_count: 0,
                item_count: 0
            },// 图文信息列表
        }
    }

    @Action('CHANGE_TAB')
    changeTab(state, tabName) {
        return state.set('tabs', tabName)
    }

    @Action('INIT_NEWS_LIST')
    initNewsList(state, o) {
        return state.update('curPage', s => o.get('curPage')).update('newsList', s => o.get('newsList'));
    }

    @Action('SET_CURRENT_PAGE')
    setCurrentPage(state, curPage) {
        return state.set('curPage', curPage);
    }

}